﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DALScolarite;
namespace Scolarite
{
    public partial class Authentification : Form
    {
        public Authentification()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {

            MessageBox.Show(typeusercomboBox.Text);

            if (typeusercomboBox.Text != string.Empty)
            {
                if (typeusercomboBox.Text == "Administrateur") {
                    if (usernametextBox.Text != string.Empty && motdepassetextBox.Text != string.Empty)
                    {
                        adminscool admin = new adminscool();
                        adminscool connect = admin.connecter(usernametextBox.Text, motdepassetextBox.Text);
                        if (connect != null)
                        {
                            Scolarite scool = new Scolarite();
                            scool.Show();
                        }
                        else
                        {
                            MessageBox.Show("Verifier vos coordonner");
                        }

                    }
                    else
                    {
                        MessageBox.Show("Verifier vos coordonner");
                    }
                  

                }
                else if (typeusercomboBox.Text == "Enseignant")
                {
                    if (usernametextBox.Text != string.Empty && motdepassetextBox.Text != string.Empty)
                    {
                        scolarite_enseignants admin = new scolarite_enseignants();
                        scolarite_enseignants connect = admin.connecter(usernametextBox.Text, motdepassetextBox.Text);
                        if (connect != null)
                        {
                            ScolariteEnseignant scool = new ScolariteEnseignant();
                            scool.Show();
                        }
                        else
                        {
                            MessageBox.Show("Verifier vos coordonner");
                        }

                    }
                    else {

                        MessageBox.Show("Verifier vos coordonner");
                    }
                  

                }
            }
        }
    }
}
